package cn.semcorp.zhuhaizj.quartzConfig;

import cn.semcorp.zhuhaizj.quartzJob.TobeUtilizationJob;
import org.quartz.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class QuartzUtilizationConfiguration {

    @Bean
    public JobDetail showUtilizationJob(){
        return JobBuilder.newJob(TobeUtilizationJob.class)
                .withIdentity("tobeUtilizationJob")
                .storeDurably()
                .build();
    }

    @Bean
    public Trigger showUtilizationTrigger(){
        CronScheduleBuilder cron =
            CronScheduleBuilder.cronSchedule("0 0 11 * * ? *");
        return TriggerBuilder.newTrigger()
                .withSchedule(cron)
                .withIdentity("showUtilizationTrigger")
                .forJob(showUtilizationJob())
                .build();
    }
}
